<?php /* Template Name: Blog with slider */ ?>
<?php get_header(); ?>

<?php
global $wp_query, $paged, $post;

$defaults = array(
    'ppp'           => '',
    'orderby'       => 'date',
    'order'         => 'DESC',
);
$opts = get_post_meta( $post->ID, 'dt_blog_slider_layout', true );
$opts = wp_parse_args( $opts, $defaults );

if( !$paged = get_query_var('paged') )
    $paged = get_query_var('page');

$args = array(
    'post_type'     => 'post',
    'post_status'   => 'publish',
    'paged'         => $paged,
    'order'         => $opts['order'],
    'orderby'       => $opts['orderby']
);

if( !empty($opts['ppp']) ) {
    $args['posts_per_page'] = $opts['ppp'];
}

$wp_query->query( $args );
?>

<div class="cols">
    <div class="col_2-3 cont_holder">

<?php if( post_password_required() ): ?>    
    
    <?php echo get_the_password_form(); ?>
    
<?php elseif( have_posts() ): ?>

	<?php while( have_posts() ): the_post(); ?>
		<?php get_template_part('content', get_post_format()); ?>
	<?php endwhile; ?>
    
	<?php 
	if( function_exists('wp_pagenavi') ) {
		wp_pagenavi( '<div class="paginator inblog">', '</div>', 'pages');
	}else {
        wp_link_pages(
            array(
                'before'        => '<div class="paginator inblog"><div class="pages">',
                'after'         => '</div></div>',
                'pagelink'      => '<span>%</span>'
            )
        );
	}
	?>
    
<?php else:?>

	<p><?php _e( 'Sorry, but page is empty.', LANGUAGE_ZONE ); ?></p>
	
<?php endif; ?>

    </div>
    
    <?php dt_get_where_filter_params( 'blog_slider' ); ?>
    <?php get_sidebar(); ?>

</div>

<?php get_footer(); ?>